import {createRouter, createWebHistory} from 'vue-router'
import index from '../views'
import signon from "@/views/account/signon";
import register from "@/views/account/register"
import myAccountForm from "@/views/account/myAccountForm";

const routes = [
    {
        path: '/',
        name: 'index',
        component: index
    },
    {
        path: '/help',
        name: 'help',
        // route level code-splitting
        // this generates a separate chunk (about.[hash].js) for this route
        // which is lazy-loaded when the route is visited.
        component: () => import(/* webpackChunkName: "about" */ '../views/help.vue')
    },
    {
        path: '/signon',
        name: 'signon',
        component: signon
    },
    {
        path: '/register',
        name: 'register',
        component: register
    },
    {
        path: '/myAccountForm',
        name: 'myAccountForm',
        component: myAccountForm
    },
    {
        path: '/mainForm',
        name: 'mainForm',
        component: () => import('../views/catalog/main')
    },
    {
        path: '/searchProduct',
        name: 'searchProduct',
        component: () => import('../views/catalog/searchProduct')
    },
    {
        path: '/productForm/:id',
        name: 'productForm',
        component: () => import('../views/catalog/product')
    },
    {
        path: '/orderList/:username',
        name: 'orderList',
        component: () => import('../views/order/orderList')
    },
    {
        path: '/viewOrderForm/:orderId',
        name: 'viewOrderForm',
        component: () => import('../views/order/viewOrderForm')
    },
    {
        path: '/newOrderForm',
        name: 'newOrderForm',
        component: () => import('../views/order/newOrderForm')
    },
    {
        path: '/confirmOrderForm',
        name: 'confirmOrderForm',
        component: () => import('../views/order/confirmOrderForm')
    },
    {
        path: '/cartForm',
        name: 'cartForm',
        component: () => import('../views/cart/cart')
    },
    {
        path: '/help',
        name: 'help',
        component: () => import('../views/help')
    },

]

const router = createRouter({
    history: createWebHistory(process.env.BASE_URL),
    routes
})

export default router
